<?php

class Application_Model_Joblog extends Application_Model_DomainObject {

    protected $_id;
    protected $_jobID;
    protected $_content;
    protected $_status;
    protected $_startTime;
    protected $_stopTime;
    protected $_countTime;

    public function getJobName()
    {
        $jobName = Application_Model_Job::load($this->_jobID);
        return $jobName?$jobName->Name:"未知任务";
    }


    public static function getByFilter($jobLogSearch,$pagesize,$pageindex)
    {
        return self::getDao()->queryPage($jobLogSearch->getSearchFileds(), " id desc ", $pagesize, $pageindex);
    }
    
    public static function getByJobId($jobId)
    {
        return self::getDao()->queryAll(array("jobID = "=>$jobId), "id desc");
    }
    
    public function getStatusName()
    {
        $lastStatusAll = Application_Model_Job::getLastStatusAll();
        return $this->_status?$lastStatusAll[$this->_status]:"未执行过";
    }

}
